import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class ListenerPage extends StatelessWidget {
  final SystemUiOverlayStyle _style =
      SystemUiOverlayStyle(statusBarColor: Colors.transparent);

  @override
  Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(_style);
    // TODO: implement build
    return MaterialApp(
      home: ListenerStatefulWidget(),
      theme: ThemeData(primarySwatch: Colors.yellow),
    );
  }
}

class ListenerStatefulWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _ListenerState();
  }
}

class _ListenerState extends State<StatefulWidget> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("Listener Page"),
      ),
      body: Listener(
        onPointerDown: (e) => {debugPrint("onPointerDown")},
        onPointerUp: (e) => {debugPrint("onPointerUp")},
        onPointerCancel: (e) => {debugPrint("onPointerCancel")},
        onPointerMove: (e) => {debugPrint("onPointerMove")},
        onPointerHover: (e) => {debugPrint("onPointerHover")},
        child: Center(
          child: Chip(label: Text("Pointer事件")),
        ),
      ),
    );
  }
}
